package titt.head.request.form;

import titt.head.HTTPHead;
import titt.head.HeadFactory;
import titt.head.Header;
import titt.head.util.AbstractHead;
import titt.type.Type;

public class MultipartHead extends AbstractHead {

	public MultipartHead(HTTPHead h) {
		super.h = h;
	}
	
	public MultipartHead(Type t) {
		this(HeadFactory.createHead(new Header("Content-Disposition", "form-data; name=\""+t.asString()+"\"")));
	}
	
	public String getName() {
		return getHeader("Content-Disposition").getValue().split("name=\"")[1].split("\"")[0];
	}
	
	public Type getType() {
		return new Type(getName());
	}
}
